<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Ogxtrainee</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Ogxtrainee</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/app/models/ogxtrainee_rb.html">
                app/models/ogxtrainee.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                ActiveRecord::Base
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000238">hay_estados</a>&nbsp;&nbsp;
      <a href="#M000236">listas_estados</a>&nbsp;&nbsp;
      <a href="#M000239">search</a>&nbsp;&nbsp;
      <a href="#M000240">search_cv</a>&nbsp;&nbsp;
      <a href="#M000237">search_estado</a>&nbsp;&nbsp;
      <a href="#M000241">search_individuals</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000238" class="method-detail">
        <a name="M000238"></a>

        <div class="method-heading">
          <a href="#M000238" class="method-signature">
          <span class="method-name">hay_estados</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000238-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000238-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/ogxtrainee.rb, line 21</span>
21:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">hay_estados</span>
22:                 <span class="ruby-keyword kw">if</span> <span class="ruby-constant">EstadoTrainee</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>) <span class="ruby-keyword kw">then</span> 
23:                                 <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
24:                <span class="ruby-keyword kw">else</span>
25:                        <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
26:                 <span class="ruby-keyword kw">end</span>           
27:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000236" class="method-detail">
        <a name="M000236"></a>

        <div class="method-heading">
          <a href="#M000236" class="method-signature">
          <span class="method-name">listas_estados</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000236-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000236-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/ogxtrainee.rb, line 10</span>
10:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">listas_estados</span>() 
11:                 <span class="ruby-ivar">@estado_ids</span> = <span class="ruby-constant">Ogxtrainee</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>).<span class="ruby-identifier">collect</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">:estado_trainee_id</span>) 
12:                 <span class="ruby-ivar">@estado</span> = <span class="ruby-constant">EstadoTrainee</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'id in (?)'</span>,<span class="ruby-ivar">@estado_ids</span>])          
13:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000239" class="method-detail">
        <a name="M000239"></a>

        <div class="method-heading">
          <a href="#M000239" class="method-signature">
          <span class="method-name">search</span><span class="method-args">(search, page)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000239-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000239-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/ogxtrainee.rb, line 29</span>
29:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">search</span>(<span class="ruby-identifier">search</span>, <span class="ruby-identifier">page</span>)
30:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">search</span>
31:         <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">3</span>, <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'id'</span>,<span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'nombre LIKE ?'</span>, <span class="ruby-node">&quot;%#{search}%&quot;</span>]
32:         <span class="ruby-keyword kw">else</span>
33:                         <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">4</span>, <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page</span>,
34:                            <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'id'</span>
35:                 <span class="ruby-keyword kw">end</span>
36:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000240" class="method-detail">
        <a name="M000240"></a>

        <div class="method-heading">
          <a href="#M000240" class="method-signature">
          <span class="method-name">search_cv</span><span class="method-args">(search, page, cv)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000240-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000240-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/ogxtrainee.rb, line 38</span>
38:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">search_cv</span>(<span class="ruby-identifier">search</span>, <span class="ruby-identifier">page</span>, <span class="ruby-identifier">cv</span>)
39:          <span class="ruby-ivar">@ogxtrainee_ids</span> = <span class="ruby-constant">Ogxcurriculum</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>).<span class="ruby-identifier">collect</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">:ogxtrainee_id</span>)
40:          <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cv</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'con'</span> <span class="ruby-keyword kw">then</span>
41:                  <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">4</span>, <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page</span>,
42:                          <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'id'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'id in (?)'</span>,<span class="ruby-ivar">@ogxtrainee_ids</span>]
43:          <span class="ruby-keyword kw">else</span> 
44:                        <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">4</span>, <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page</span>,
45:                  <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'id'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'id not in (?)'</span>,<span class="ruby-ivar">@ogxtrainee_ids</span>]       
46:          <span class="ruby-keyword kw">end</span>
47:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000237" class="method-detail">
        <a name="M000237"></a>

        <div class="method-heading">
          <a href="#M000237" class="method-signature">
          <span class="method-name">search_estado</span><span class="method-args">(search, page, estado_id)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000237-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000237-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/ogxtrainee.rb, line 16</span>
16:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">search_estado</span>(<span class="ruby-identifier">search</span>, <span class="ruby-identifier">page</span>, <span class="ruby-identifier">estado_id</span>)
17:                 <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">4</span>, <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page</span>,
18:                          <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'id'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'estado_trainee_id = '</span><span class="ruby-operator">+</span><span class="ruby-identifier">estado_id</span>]
19:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000241" class="method-detail">
        <a name="M000241"></a>

        <div class="method-heading">
          <a href="#M000241" class="method-signature">
          <span class="method-name">search_individuals</span><span class="method-args">(search, page, ids)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000241-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000241-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/ogxtrainee.rb, line 49</span>
49:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">search_individuals</span>(<span class="ruby-identifier">search</span>, <span class="ruby-identifier">page</span>, <span class="ruby-identifier">ids</span>)
50:          <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">4</span>, <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page</span>,
51:                          <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'id'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'id in (?)'</span>,<span class="ruby-identifier">ids</span>]
52:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>